#
# weapon.py -- rendering weapon shots
# 
# author: Tom "Knio" Flanagan
#         knio@h4xn3t.net
#         theknio@gmail.com
#         irc.freenode.net - Knio - #python #pygame #py
#
# this file released under Public Domain
#


from constants import *


class Weapon:
    def __init__(self, view, model):
        self.view = view
        self.model = model
        self.__class__ = globals()[self.model.__class__.__name__]

    def tick(self):
        pass

class MissileLauncher(Weapon):
    pass

class Laser(Weapon):
    def tick(self):
        if not self.model.ship.state: return
        for i in self.model.targets:
            x1 = self.view.offset+i.x
            y1 = self.view.offset-i.y
            x2 = self.view.offset+self.model.ship.x
            y2 = self.view.offset-self.model.ship.y
            pygame.draw.line(self.view.screen, self.model.ship.view.color, (x1, y1), (x2, y2))

        
